//
//  Student.m
//  SaveDate
//
//  Created by 胡先剑 on 16/3/15.
//  Copyright © 2016年 胡先剑. All rights reserved.
//

#import "Student.h"

#define kStuId @"StuId"
#define KStuName @"StuName"
#define kStuAge @"StuAge"

@implementation Student

- (instancetype)initWithId:(NSString *)tmpStuId andName:(NSString *)tmpStuName andAge:(NSString *)tmpStuAge
{
    self = [super init];
    if (self) {
        self.stuId = tmpStuId;
        self.stuName = tmpStuName;
        self.stuAge = tmpStuAge;
    }
    return self;
}

- (void)encodeWithCoder:(NSCoder *)aCoder
{
    [aCoder encodeObject:self.stuId forKey:kStuId];
    [aCoder encodeObject:self.stuName forKey:KStuName];
    [aCoder encodeObject:self.stuAge forKey:kStuAge];
}
- (nullable instancetype)initWithCoder:(NSCoder *)aDecoder
{
    self = [super init];
    if (self)
    {
        self.stuId = [aDecoder decodeObjectForKey:kStuId];
        self.stuName = [aDecoder decodeObjectForKey:KStuName];
        self.stuAge = [aDecoder decodeObjectForKey:kStuAge];
    }
    return self;
}

- (NSString *)description
{
    return [NSString stringWithFormat: @"%@ %@ %@",self.stuId,self.stuName,self.stuAge];
}
@end
